layui.use(['form'], function () {
    var form = layui.form;
    var layer = layui.layer;
    var myDatas={
        text:'',
        title:'',
        type:1
    }
    setWangeditor('#editor-consumerNotice','#toolbar-consumerNotice',$('#consumerNotice').val(),'请输入内容',function onchange(editor){
        myDatas.text = editor.getHtml()
    },null,$('#type')=='info')
    //提交事件
    form.on('submit(submit)', function (data) {
        console.log(data.field,myDatas,$('#type').val())
        myDatas.title=data.field.title
        myDatas.type=data.field.orderType
        myDatas.orderLimit=data.field.orderLimit
        if(myDatas.text=='<p><br></p>'){
            layer.msg('请输入内容')
            return false
        }
        if($('#type').val()=='add'){
            Url='/jzweb/jazQuestion/save'
        }else{
             Url='/jzweb/jazQuestion/update'
            myDatas.id=$('#dataId').val()
        }
        AjaxPost(Url, myDatas).then(function (response) {
            parent.layer.msg("操作成功");
            var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
            parent.layer.close(index);
            parent.load();
        }).catch(error => {
            layer.msg(error.msg)
        })
        return false;
    });


});